package com.banmajio.controller;

import com.banmajio.service.DataCleanningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 数据清洗控制器
 */
@RestController
@RequestMapping("/clean")
public class DataCleanController {

    @Autowired
    private DataCleanningService dataCleanService;

    /**
     * 执行数据清洗任务
     */
    @GetMapping("/execute/{sourceTable}/{targetTable}")
    public String executeDataClean(@PathVariable String sourceTable, @PathVariable String targetTable) throws InterruptedException {
        dataCleanService.executeDataCleanProcess(sourceTable, targetTable);
        return "数据清洗任务已启动";
    }
}